{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set menu = 'admin_user_manage' %}

{% set script_controller = 'user/list' %}

{% block main %}

{{ web_macro.flash_messages() }}

 <form id="user-search-form" class="form-inline well well-sm" action="" method="get" novalidate>
  <div class="mbm">
      <select class="form-control" name="datePicker" id="datePicker">
        {{ select_options({longinDate:'登录时间', registerDate: '注册时间'}, app.request.get('datePicker') ,'--时间类型--') }}
      </select>

    <div class="form-group ">
        <input class="form-control" type="text" id="startDate" name="startDate" value="{{app.request.query.get('startDate')}}" placeholder="起始时间">
        -
        <input class="form-control" type="text" id="endDate" name="endDate" value="{{app.request.query.get('endDate')}}" placeholder="结束时间">
    </div>
  </div>
    <div class="form-group">
      <select class="form-control" name="roles">
        {{ select_options(dict('userRole'), app.request.query.get('roles'), '--所有角色--') }}
      </select>
    </div>

    <span class="divider"></span>
    <div class="form-group">
      <select id="keywordUserType" name="keywordUserType" class="form-control">
        {{ select_options(dict('userType'), app.request.query.get('keywordUserType'), '--注册来源--') }}
      </select>
    </div>
    
    <div class="form-group">
      <select id="keywordType" name="keywordType" class="form-control">
        {{ select_options(dict('userKeyWordType'), app.request.query.get('keywordType'), '--关键词类型--') }}
      </select>
    </div>

    <div class="form-group">
      <input type="text" id="keyword" name="keyword" class="form-control" value="{{ app.request.query.get('keyword') }}" placeholder="关键词">
    </div>


    <button class="btn btn-primary">搜索</button>

    {% if is_granted('ROLE_SUPER_ADMIN') %}
       {% if showUserExport %}
        <a class="btn btn-primary mhs" id="user-export" data-toggle="modal" data-target="#modal" data-url="{{path('admin_user_export')}}">导出搜索结果</a>

        {% endif %}
    {% endif %}
  </form>

<table id="user-table" class="table table-striped table-hover" data-search-form="#user-search-form">
  <thead>
    <tr>
      <th>用户名</th>
      <th>手机号</th>
      <th>Email</th>
      <th>注册时间</th>
      <th>最近登录</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    {% for user in users %}
      {% include 'TopxiaAdminBundle:User:user-table-tr.html.twig' with {user:user,profile:profiles[user.id]} %}
    {% endfor %}
  </tbody>
</table>
 {{ web_macro.paginator(paginator) }} 
{% endblock %}